<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
    <meta name="author" content="">
    <title>选项卡页面</title>  <link rel="icon" href="/template/pc1/images/wmh_favicon.ico" type="image/x-icon" />
    <% include("../inc/list_css.html"){}%>
</head>
<body>
<div class="ibox">
    <div class="ibox-title">
        <div class="pull-left mbx navbar_title"><span class="current">品牌用户 </span>
            <span class="line">/</span>
            会员列表
        </div>
    </div>
    <div class="ibox-content">
        <div class="colorful-tab-wrapper" id="colorful-flatline">

            <ul class="colorful-tab-menu ">

                <li class="colorful-tab-menu-item active relative_position">
                    <a href="#fl-0">品牌会员</a>
                    <div class="tab_div">
                    </div>
                </li>
                <li class="colorful-tab-menu-item relative_position margin-left_-15">
                    <a href="#fl-1">微信粉丝</a>
                    <div class="tab_div">
                    </div>
                </li>
                <!--<li class="colorful-tab-menu-item relative_position margin-left_-15">
                    <a href="#fl-2">潜在用户</a>
                    <div class="tab_div">
                    </div>
                </li>-->

            </ul>
            <div class="colorful-tab-container margin-top-8">
                <div class="colorful-tab-content active" id="fl-0">
                    <div class="row padding-right-20">
                        <div class="col-md-12 padding-bottom-80">
                            <div class="btn-group margin-vertical-4_20">
                                <button type="button" class="hive-btn-md-large hive-btn-primary" id="importBrandMember">导入</button>
                            </div>

                            <div id="eventsToolbar_1" class="form-inline">
                                <input class="light-input layer-date " data-skin="default" id="starttime_1" onclick="laydate({istime:true,format:'YYYY-MM-DD'})" placeholder="开始时间" style="vertical-align:bottom"/>
                                <input class="light-input layer-date  checkspace" data-skin="default" id="endtime_1" onclick="laydate({istime:true,format:'YYYY-MM-DD'})" placeholder="结束时间" style="vertical-align:bottom"/>

                                &nbsp;&nbsp;地区
                                <select name="province_1" class="light-input" id="location_p_1" ></select>
                                <select name="city_1" class="light-input" id="location_c_1" ></select>
                                <select name="district_1" class="light-input" id="location_a_1"></select>
                                <script src="/res/plugins/jiuyue/region_select_check.js"></script>
                                <script type="text/javascript">
                                    new PCAS('province_1', 'city_1', 'district_1', '', '', '');
                                </script>
                                <input class="light-input" name="title_id" id="name_1" placeholder="手机号、姓名" style="width: 230px">
                                <button class="hive-btn margin-left-5"  onclick="searchList_1()">&nbsp;搜索&nbsp;
                                </button>
                            </div>

                            <table data-toggle="table " id="table1" data-show-export="true" class="hive_table table-striped table-no-bordered fixed-table-container table-row-border-color table-hovered table-hover">
                                <!--  data-url="https://static.9hive.cn/hive/assets/data/data.json" -->
                                <thead class="table-header">
                                <tr>
                                    <th data-field="phone">手机号</th>
                                    <th data-field="realname">姓名</th>
                                    <th data-field="memberRankName">会员等级</th>
                                    <th data-field="city">城市</th>
                                    <th data-field="birthday">生日</th>
                                    <th data-field="createDate">入会时间</th>
                                    <!--<th data-field="phone">会员有效期</th>-->
                                    <th data-field="head" data-formatter="opFormatter_1" data-halign="center"  data-align="center" data-width="160">操作</th>
                                </tr>
                                </thead>
                            </table>

                        </div>
                    </div>

                </div>
                <div class="colorful-tab-content " id="fl-1">
                    <div class="row padding-right-20">
                        <div class="col-md-12 padding-bottom-80">
                            <div class="btn-group margin-vertical-4_20">
                                <button type="button" class="hive-btn-md-large hive-btn-primary" id="getFansFromWeixin">公众号同步</button>
                            </div>

                            <div id="eventsToolbar_2" class="form-inline">
                                <input class="light-input layer-date " data-skin="default" id="starttime_2" onclick="laydate({istime:true,format:'YYYY-MM-DD'})" placeholder="开始时间" style="vertical-align:bottom"/>
                                <input class="light-input layer-date  checkspace" data-skin="default" id="endtime_2" onclick="laydate({istime:true,format:'YYYY-MM-DD'})" placeholder="结束时间" style="vertical-align:bottom"/>

                                &nbsp;&nbsp;地区
                                <select name="province_2" class="light-input" id="location_p" ></select>
                                <select name="city_2" class="light-input" id="location_c" ></select>
                                <select name="district_2" class="light-input" id="location_a"></select>

                                <script type="text/javascript">
                                    new PCAS('province_2', 'city_2', 'district_2', '', '', '');
                                </script>
                                <input class="light-input" name="title_id" id="name_2" placeholder="昵称" style="width: 230px">
                                <button class="hive-btn margin-left-5" id="search" onclick="searchList_2()">&nbsp;搜索&nbsp;
                                </button>
                            </div>
                            <table data-toggle="table " id="table2" data-show-export="true" class="hive_table table-striped table-no-bordered fixed-table-container table-row-border-color table-hovered table-hover">
                                <!--  data-url="https://static.9hive.cn/hive/assets/data/data.json" -->
                                <thead class="table-header">
                                <tr>
                                    <th data-field="number" data-formatter="numberFormatter">序号</th>
                                    <th data-field="username">用户名</th>
                                    <th data-field="realname">真实姓名</th>
                                    <th data-field="code">编码</th>
                                    <th data-field="sex" data-formatter="sexFormatter">性别</th>
                                    <!--<th data-field="memberRankname">会员等级</th>-->
                                    <th data-field="phone">联系方式</th>
                                    <th data-field="topUsername">推荐人昵称</th>
                                    <th data-field="topRealname">推荐人姓名</th>
                                    <th data-field="topCode">推荐人编码</th>
                                    <th data-field="createDate">注册日期</th>
                                    <th data-field="isAccountLocked" data-formatter="stateFormatter">状态</th>
                                    <th data-field="head" data-formatter="opFormatter_1" data-halign="center"  data-align="center" data-width="160">操作</th>
                                </tr>
                                </thead>
                            </table>

                        </div>
                    </div>
                </div>
                <div class="colorful-tab-content " id="fl-2">
                    <div class="row padding-right-20">
                        <div class="col-md-12 padding-bottom-80">
                            <div class="btn-group margin-vertical-4_20">
                                <button type="button" class="hive-btn-md-large hive-btn-primary" id="importpotentialMember">导入</button>
                            </div>

                            <div id="eventsToolbar_3" class="form-inline">
                                <input class="light-input layer-date " data-skin="default" id="starttime_3" onclick="laydate({istime:true,format:'YYYY-MM-DD'})" placeholder="开始时间" style="vertical-align:bottom"/>
                                <input class="light-input layer-date  checkspace" data-skin="default" id="endtime_3" onclick="laydate({istime:true,format:'YYYY-MM-DD'})" placeholder="结束时间" style="vertical-align:bottom"/>

                                &nbsp;&nbsp;地区
                                <select name="province_3" class="light-input" id="location_p_3" ></select>
                                <select name="city_3" class="light-input" id="location_c_3" ></select>
                                <select name="district_3" class="light-input" id="location_a_3"></select>
                                <script type="text/javascript">
                                    new PCAS('province_3', 'city_3', 'district_3', '', '', '');
                                </script>
                                <input class="light-input" name="title_id" id="name_3" placeholder="手机号" style="width: 230px">
                                <button class="hive-btn margin-left-5"  onclick="searchList_3()">&nbsp;搜索&nbsp;
                                </button>
                            </div>
                            <table data-toggle="table " id="table3" data-show-export="true" class="hive_table table-striped table-no-bordered fixed-table-container table-row-border-color table-hovered table-hover">
                                <!--  data-url="https://static.9hive.cn/hive/assets/data/data.json" -->
                                <thead class="table-header">
                                <tr>
                                    <th data-field="number" data-formatter="numberFormatter">序号</th>
                                    <th data-field="username">用户名</th>
                                    <th data-field="realname">真实姓名</th>
                                    <th data-field="code">编码</th>
                                    <th data-field="sex" data-formatter="sexFormatter">性别</th>
                                    <th data-field="memberRankname">会员等级</th>
                                    <th data-field="phone">联系方式</th>
                                    <th data-field="topUsername">推荐人昵称</th>
                                    <th data-field="topRealname">推荐人姓名</th>
                                    <th data-field="topCode">推荐人编码</th>
                                    <th data-field="createDate">注册日期</th>
                                    <!--<th data-field="isAccountLocked" data-formatter="stateFormatter">状态</th>-->
                                    <th data-field="head" data-formatter="opFormatter_2" data-halign="center"  data-align="center" data-width="160">操作</th>
                                </tr>
                                </thead>
                            </table>

                        </div>
                    </div>
                </div>

            </div>

        </div>
    </div>


</div>

<% include("../inc/list_js.html"){}%>
<script src="https://static.9hive.cn/global/vendor/layer/laydate/laydate.js"></script>
<script>
    var childBody;
    $('#importBrandMember').on('click', function () {
        parent.layer.open({
            shade: [0.3, '#fff'],
            type: 2, move: false,  resize: false,
            title: '导入品牌会员',
            content: "/mall/admin/brandmember/importBrandMember",
            area: ['420px', '300px'],
            btn: ['上传文件', '取消'],
            btnAlign: 'c',
            scrollbar: false,
            success: function (layero, index) {
                childBody = parent.layer.getChildFrame('body', index);
            },
            yes: function () {
                childBody.find('#button').click();
            },
            btn2: function () {
                parent.layer.closeAll();
            }
        });
    });
    $('#importpotentialMember').on('click', function () {
        parent.layer.open({
            shade: [0.3, '#fff'],
            type: 2, move: false,  resize: false,
            title: '导入品牌会员',
            content: "/mall/admin/brandmember/importpotentialMember",
            area: ['420px', '300px'],
            btn: ['上传文件', '取消'],
            btnAlign: 'c',
            scrollbar: false,
            success: function (layero, index) {
                childBody = parent.layer.getChildFrame('body', index);
            },
            yes: function () {
                childBody.find('#button').click();
            },
            btn2: function () {
                parent.layer.closeAll();
            }
        });
    });
    $("#getFansFromWeixin").click(function () {
        var index = parent.layer.load(0, {
            shade: [0.3,'#fff'] //0.1透明度的白色背景
        });
        $.post('/mall/admin/brandmember/getFansFromWeixin',{},function (e) {
            if(e.state =='ok'){
                parent.layer.msg("同步完成!");
                $('#table2').bootstrapTable('refresh');
            }else{
                parent.layer.msg("操作失败!");

            }
            parent.layer.close(index);
        })
    });
    $(document).ready(function () {
        $("#colorful-flatline").colorfulTab({
            theme: "flatline"
        });

    });

    (function (document, window, $) {
        'use strict';

        var Site = window.Site;
        $(document).ready(function () {
            Site.run();
        });
    })(document, window, jQuery);


    function refresh_table1() {
        $('#table1').bootstrapTable('refresh');
    }
    function searchList_1(){
        var starttime=$("#starttime_1").val();
        var endtime=$("#endtime_1").val();
        var province=$("#location_p_1").val();
        var city=$("#location_c_1").val();
        var district=$("#location_a_1").val();
        var name=$("#name_1").val();
        $('#table1').bootstrapTable("refresh",{query: {starttime:starttime,endtime:endtime,province:province,city:city,district:district,name:name,sourceType:1}});
    }
    $('#table1').bootstrapTable({
        url: "ajaxlist?sourceType=1",
        dataType: 'json',
        contentType: 'application/json',
        search: false,
        searchAlign: 'right',
        pagination: true,
        showRefresh: true,
        pageSize: 20,
        showToggle: false,//是否显示card/table切换按钮
        showColumns: true,//是否显示内容列下拉框
        pageList: [20, 50, 100],
        iconSize: 'outline',
        toolbar: '#eventsToolbar_1',
        paginationHAlign: 'right', //right, left
        paginationVAlign: 'bottom',
        formatNoMatches: function () { //判断有无数据
            var imghtml = '<div class="flexed_column content_center content_alignCenter padding-20"><img src="https://static.9hive.cn/global/img/nodata.png" class="no_data"/><span class="font-size-16">暂无数据</span></div>';
            return imghtml;
        },
        formatLoadingMessage: function () {  //数据加载中样式
            return ' <div id="loading"><div id="loading-center">' +
                '<div id="loading-center-absolute"><div class="object" id="object_one">' +
                '</div><div class="object" id="object_two"></div><div class="object" id="object_three">' +
                '</div><div class="object" id="object_four"></div></div></div>努力加载中...</div>'
        },
        icons: {
            refresh: 'icon-refresh',
            toggle: 'glyphicon-list-alt',
            columns: 'icon-select',
            export: 'icon-export'
        },
    });
    function opFormatter_1(value, row, index){
        var html ='';
        html = '<a href="javascript:void(0)" onclick="a(\''+row.id+'\',\''+row.username+'\');" ><i class="fa fa-angle-double-down" data-toggle="tooltip" data-placement="top" title="下级推荐树"></i>下级</a>';
        html += '<a href="javascript:void(0)" onclick="getParentUsername(\''+row.id+'\');" ><span style="margin-left:10px;"><i class="fa fa-angle-double-up" data-toggle="tooltip" data-placement="top" title="上级推荐关系"></i></span>上级</a>';
        html += '<a href="javascript:void(0)" onclick="getUserBackMoney(\''+row.id+'\');" ><span style="margin-left:10px;"><i class="fa fa-spinner" data-toggle="tooltip" data-placement="top" title="分销金额列表"></i></span>分销金额</a>';
        /*html += '<a href="javascript:void(0)" onclick="addMoney(\''+row.id+'\');" ><span style="margin-left:10px;" data-toggle="modal" data-target="#addMoney"><i class="fa fa-cny" data-toggle="tooltip" data-placement="top" title="预存款充值"></i></span>预存款充值</a>';
         html += '<a href="javascript:void(0)" onclick="addPoint(\''+row.id+'\');" ><span style="margin-left:10px;" data-toggle="modal" data-target="#addPoint"><i class="fa fa-btc" data-toggle="tooltip" data-placement="top" title="积分充值"></i></span>积分充值</a>';
         html += '<a href="javascript:void(0)" onclick="resetMemberPassword(\''+row.id+'\');" ><span style="margin-left:10px;"><i class="fa fa-hand-paper-o" data-toggle="tooltip" data-placement="top" title="重置用户密码"></i></span>重置用户密码</a>';*/
        return html;
    }
    function memberDetail(v,sourceType) {
        window.location.href="memberDetail?memberId="+v+"&sourceType="+sourceType+"";
    }



    function searchList_2(){
        var starttime=$("#starttime_2").val();
        var endtime=$("#endtime_2").val();
        var province=$("#location_p_2").val();
        var city=$("#location_c_2").val();
        var district=$("#location_a_2").val();
        var name=$("#name_2").val();
        $('#table2').bootstrapTable("refresh",{query: {starttime:starttime,endtime:endtime,province:province,city:city,district:district,name:name,sourceType:2}});
    }
    $('#table2').bootstrapTable({
        url: "/mall/admin/businessmember/ajaxlist?sourceType=2",
        dataType: 'json',
        contentType: 'application/json',
        search: false,
        searchAlign: 'right',
        pagination: true,
        showRefresh: true,
        pageSize: 20,
        showToggle: false,//是否显示card/table切换按钮
        showColumns: true,//是否显示内容列下拉框
        pageList: [20, 50, 100],
        iconSize: 'outline',
        toolbar: '#eventsToolbar_2',
        paginationHAlign: 'right', //right, left
        paginationVAlign: 'bottom',
        formatNoMatches: function () { //判断有无数据
            var imghtml = '<div class="flexed_column content_center content_alignCenter padding-20"><img src="https://static.9hive.cn/global/img/nodata.png" class="no_data"/><span class="font-size-16">暂无数据</span></div>';
            return imghtml;
        },
        formatLoadingMessage: function () {  //数据加载中样式
            return ' <div id="loading"><div id="loading-center">' +
                '<div id="loading-center-absolute"><div class="object" id="object_one">' +
                '</div><div class="object" id="object_two"></div><div class="object" id="object_three">' +
                '</div><div class="object" id="object_four"></div></div></div>努力加载中...</div>'
        },
        icons: {
            refresh: 'icon-refresh',
            toggle: 'glyphicon-list-alt',
            columns: 'icon-select',
            export: 'icon-export'
        },

    });
    function opFormatter(value, row, index){
        var html ='';
        html = '<a href="javascript:void(0)" onclick="a(\''+row.id+'\',\''+row.username+'\');" ><i class="fa fa-angle-double-down" data-toggle="tooltip" data-placement="top" title="下级推荐树"></i>下级</a>';
        html += '<a href="javascript:void(0)" onclick="getParentUsername(\''+row.id+'\');" ><span style="margin-left:10px;"><i class="fa fa-angle-double-up" data-toggle="tooltip" data-placement="top" title="上级推荐关系"></i></span>上级</a>';
        html += '<a href="javascript:void(0)" onclick="getUserBackMoney(\''+row.id+'\');" ><span style="margin-left:10px;"><i class="fa fa-spinner" data-toggle="tooltip" data-placement="top" title="分销金额列表"></i></span>分销金额</a>';
        /*html += '<a href="javascript:void(0)" onclick="addMoney(\''+row.id+'\');" ><span style="margin-left:10px;" data-toggle="modal" data-target="#addMoney"><i class="fa fa-cny" data-toggle="tooltip" data-placement="top" title="预存款充值"></i></span>预存款充值</a>';
         html += '<a href="javascript:void(0)" onclick="addPoint(\''+row.id+'\');" ><span style="margin-left:10px;" data-toggle="modal" data-target="#addPoint"><i class="fa fa-btc" data-toggle="tooltip" data-placement="top" title="积分充值"></i></span>积分充值</a>';
         html += '<a href="javascript:void(0)" onclick="resetMemberPassword(\''+row.id+'\');" ><span style="margin-left:10px;"><i class="fa fa-hand-paper-o" data-toggle="tooltip" data-placement="top" title="重置用户密码"></i></span>重置用户密码</a>';*/
        return html;
    }


    function refresh_table3() {
        $('#table3').bootstrapTable('refresh');
    }
    function searchList_3(){
        var starttime=$("#starttime_3").val();
        var endtime=$("#endtime_3").val();
        var province=$("#location_p_3").val();
        var city=$("#location_c_3").val();
        var district=$("#location_a_3").val();
        var name=$("#name_3").val();
        $('#table3').bootstrapTable("refresh",{query: {starttime:starttime,endtime:endtime,province:province,city:city,district:district,name:name,sourceType:3}});
    }
    $('#table3').bootstrapTable({
        url: "ajaxlist?sourceType=3",
        dataType: 'json',
        contentType: 'application/json',
        search: false,
        searchAlign: 'right',
        pagination: true,
        showRefresh: true,
        pageSize: 20,
        showToggle: false,//是否显示card/table切换按钮
        showColumns: true,//是否显示内容列下拉框
        pageList: [20, 50, 100],
        iconSize: 'outline',
        toolbar: '#eventsToolbar_3',
        paginationHAlign: 'right', //right, left
        paginationVAlign: 'bottom',
        formatNoMatches: function () { //判断有无数据
            var imghtml = '<div class="flexed_column content_center content_alignCenter padding-20"><img src="https://static.9hive.cn/global/img/nodata.png" class="no_data"/><span class="font-size-16">暂无数据</span></div>';
            return imghtml;
        },
        formatLoadingMessage: function () {  //数据加载中样式
            return ' <div id="loading"><div id="loading-center">' +
                '<div id="loading-center-absolute"><div class="object" id="object_one">' +
                '</div><div class="object" id="object_two"></div><div class="object" id="object_three">' +
                '</div><div class="object" id="object_four"></div></div></div>努力加载中...</div>'
        },
        icons: {
            refresh: 'icon-refresh',
            toggle: 'glyphicon-list-alt',
            columns: 'icon-select',
            export: 'icon-export'
        },

    });
    function opFormatter_3(value, row, index){
        var html='';
        html += '<a href="javascript:void(0)" class="icon-tab_details hive_icon color_normal" onclick="memberDetail(\''+row.id+'\',3);" data-toggle="tooltip" data-placement="top" title="会员详情"></a>';
        return html;
    }


    function sexFormatter(value) {
        if(value){
            if(value == 1)
                return '男';
            if(value == 2)
                return '女';
            if(value == 0 || value == null)
                return '未知';
        }else{
            return '未知';
        }
    }


    function a(id,name) {
        parent.layer.open({
            type: 2,
            title: name+'的分销关系',
            shadeClose: true,
            shade: 0.8,
            area: ['70%', '98%'],
            content: '/mall/admin/businessmember/fxrelation?id='+id //iframe的url
        });
    }

    function getParentUsername(id) {

        parent.layer.open({
            type: 2,
            title: '父推荐关系',
            shadeClose: true,
            shade: 0.8,
            area: ['80%', '90%'],
            content: '/mall/admin/businessmember/getAllParentForm?id='+id //iframe的url
        })

//        $.post('${base}/html/getUserParent.jsp',{"pid":id},function (data) {
//            toastr.success(data, '上级信息')
//        });
    }

    function getUserBackMoney(id) {

        parent.layer.open({
            type: 2,
            title: '返佣列表',
            shadeClose: true,
            shade: 0.8,
            area: ['80%', '70%'],
            content: '/mall/admin/businessmember/getUserBackMoneyForm?id='+id //iframe的url
        })
    }

    function numberFormatter(value, row, index){
        return index+1;
    }


</script>
</body>
</html>